<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="DaosImpl.ClientDaoImpl" %>
<%@ page import="Beans.Client" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<%
		String path = request.getContextPath();
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
	 %>
  <head>
     <meta charset="UTF-8">
    <title>客户信息</title>
    <link href=<%=basePath+"/stylesheets/clientInfo.css" %> type="text/css" rel="stylesheet">
    <style>
        html,body{
            height: 100%;
            margin:0;
            padding: 0;
        }
    </style>

  </head>
  
  <body>
  	<%
  		String msg = (String)session.getAttribute("msg");
  		session.removeAttribute("msg");
  		if(msg!=null&&msg!=""){
  			%>
  			<script type="text/javascript">
  				var msg = '<%=msg%>';
  				alert(msg);
  			</script>
  			<%
  		}
  	 %>
    <div id="themeText">酒店客户信息查看</div>
	<div id="showRoomFrame">
		<div id="manageInfo">
        	<button  class="importBtn" onclick="window.location.href = 'http://localhost:8080/HotelSystem/Servlets/ExportInfoServlet?judge=0'">导出信息</button>
        	<button class="exportBtn" onclick="window.location.href = 'http://localhost:8080/HotelSystem/Servlets/ImportInfoServlet?judge=0'">导入信息</button>
    	</div>
		<table cellpadding="0" cellspacing="0" id="clientTable">
	        <thead>
	        <tr>
	            <th>顾客姓名</th>
	            <th>身份证</th>
	            <th>年龄</th>
	            <th>电话</th>
	            <th>性别</th>
	            <th>是否黑名单</th>  
	        </tr>
	        </thead>
	        <tbody>
	        <%
	        	ArrayList<Client> clientList = new ArrayList<Client>();
	        	ClientDaoImpl clientDao = new ClientDaoImpl();
	        	clientList = clientDao.queryAllClients();
	        	String name="",idcard="",age="",phone="",sex="",blackList="";
	        	for(int i = 0;i<clientList.size();i++){
	        		name = clientList.get(i).getName();
	        		idcard = clientList.get(i).getId();
	        		age = String.valueOf(clientList.get(i).getAge());
	        		phone = clientList.get(i).getPhone();
	        		sex = clientList.get(i).getSex();
	        		blackList = clientList.get(i).getBlackList();
	        		%>
	        		<tr>
		            	<td width="20%"><%=name %></td>
		            	<td width="20%"><%=idcard %></td>
		            	<td width="15%"><%=age %></td>
		            	<td width="20%"><%=phone %></td>
		            	<td width="15%"><%=sex %></td>
		            	<td width="20%"><%=blackList %></td>
	        		</tr>
	        		<%
	        	}
	         %>
	        </tbody>
    	</table>
	</div>
  </body>
</html>
